ACM ICPC::Regional Warmup 1 (Easy version) + Algunos cambios en el manual
[andmenj-acm.git] / 11040 - Add bricks in the wall / 11040.Jesus-Federico.cpp
blobcad45eb38de9dbd24bc895ce7040ada690dfe0b2
1 #include <cstdio>
2 #include <cmath>
3 #include <map>
4 #include <vector>
5 #include <algorithm>
6 #include <iostream>
7 #include <string>
8 #include <set>
9 #include <sstream>
10 #include <cstdlib>
11 #include <stack>
12 #include <queue>
13 #define FOR(i,j,n) for (int i=j;i<n;++i)
14 #define FORI(i,j,n) for (int i=j;i<=n;++i)
15 #define FORN(i,n) FOR(i,0,n)
16 #define sz size()
17 #define foreach(i, c) for( __typeof( (c).begin() ) i = (c).begin(); i != (c).end(); ++i )
18 #define CPRESENT(container, element) (find(ALL(container),element) != container.end())
19 #define MIN(a,b) (a < b ? a : b)
20 #define MAX(a,b) (a > b ? a : b)
21 #define ALL(x) x.begin(), x.end()
22 #define PB push_back
23 #define INF 1<<30
25 using namespace std;
26 int b,c,e,d,n;
28 int t[100][100];
29 int main(){
30 cin>>n;
32 while(n--){
34 memset(t,0,sizeof(t));
35 for (int i=0;i<9;i+=2){
36 for (int j=0;j<(i/2)+1;j++){
37 cin>>t[i][2*j];
41 for (int i=2;i<9;i+=2){
42 for (int j=1,num=0;num<i/2;num++,j+=2){
43 t[i][j]=(t[i-2][j-1]-t[i][j-1]-t[i][j+1])/2;
47 for (int i=1;i<9;i+=2){
48 for (int j=0;j<=i;j++){
49 t[i][j]=t[i+1][j]+t[i+1][j+1];
53 FORN(i,9){
54 bool entre=0;
55 FORN(j,i+1){
56 if (entre) cout<<" ";
57 entre=1;
58 cout<<t[i][j];
60 cout<<endl;
65 return 0;